﻿using System;
using System.Globalization;
using System.Windows.Data;

namespace RomBotUI.Helpers
{
    internal class LowerBooleanConverter : IValueConverter
    {
        public object Convert( object value, Type targetType, object parameter, CultureInfo culture )
        {
            if ( value != null )
            {
                if ( !string.IsNullOrWhiteSpace( value.ToString() ) )
                {
                    return System.Convert.ToBoolean( value );
                }
            }
            return ( bool? ) null;
        }

        public object ConvertBack( object value, Type targetType, object parameter, CultureInfo culture )
        {

            return value != null ? value.ToString().ToLower() : null;
        }
    }
}
